Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add indices_boost option support #283

Merged
merged 1 commit into from
Jul 26, 2016
Merged

add indices_boost option support #283

merged 1 commit into from
Jul 26, 2016

Conversation

exAspArk
Copy link
Contributor

Hi, I'd like to add indices_boost support. For example:

User.search("*", index_name: ["foo", "bar"], indices_boost: { foo: 1, bar: 2 })

@ankane
Copy link
Owner

ankane commented Sep 18, 2014

Awesome, thanks @exAspArk! To get this ready for a merge, the readme needs updated and a test case added. You want to give it a shot?

@exAspArk
Copy link
Contributor Author

@ankane done :) Please have a look, I've made some workarounds with aliases while Elasticsearch can not use them for indices_boost.

@exAspArk
Copy link
Contributor Author

@ankane ping :)

@jslauthor
Copy link

It's a shame this was never accepted. I had to write a custom query to get around it. :/

@ankane
Copy link
Owner

ankane commented Jul 24, 2016

Hey @exAspArk, sorry for letting this stagnate. It looks like there's still an issue with the indices_boost and aliases. I'm not excited about the performance implications of this approach (an additional Elasticsearch call for each index), but seems like the best we can do. We could cache the aliases, but would need to invalidate them after a reindex, which could be hard to detect without additional complexity. I've added a few comments inline. Happy to merge once they are addressed.

Boost indices when searching across more than one index

```ruby
indices_boost: { Animal.searchkick_index.name => 1, Product.searchkick_index.name => 200 }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also allow indices_boost: {Animal: 1, Product: 200}? We do this with the index_name option.

@ankane ankane added the waiting label Jul 24, 2016
@exAspArk
Copy link
Contributor Author

Hey @ankane, thanks for your feedback! I've pushed the changes.

Yep, it's sad that we have to make additional requests while the issue is still open elastic/elasticsearch#4756.

@@ -168,6 +168,12 @@ boost_where: {user_id: {value: 1, factor: 100}} # default factor is 1000
boost_where: {user_id: [{value: 1, factor: 100}, {value: 2, factor: 200}]}
```

Boost indices when searching across more than one index
Copy link
Owner

@ankane ankane Jul 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this to a section about searching multiple indexes? (maybe right above the reference section)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I can take this one. Thanks @exAspArk!

@ankane ankane merged commit 9c1a0ff into ankane:master Jul 26, 2016
@ankane
Copy link
Owner

ankane commented Jul 26, 2016

👍

@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants